package com.android.wechat.msg.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.android.wechat.msg.entity.TMsgListEntity;
import com.android.wechat.msg.service.TMsgListService;
import com.android.common.utils.PageUtils;
import com.android.common.utils.R;



/**
 * 
 *
 * @author laozj
 * @email laozj@wechat.com
 * @date 2024-05-04 20:41:28
 */
@RestController
@RequestMapping("msg/tmsglist")
public class TMsgListController {
    @Autowired
    private TMsgListService tMsgListService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tMsgListService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{msgListId}")
    public R info(@PathVariable("msgListId") Long msgListId){
		TMsgListEntity tMsgList = tMsgListService.getById(msgListId);

        return R.ok().put("tMsgList", tMsgList);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TMsgListEntity tMsgList){
		tMsgListService.save(tMsgList);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TMsgListEntity tMsgList){
		tMsgListService.updateById(tMsgList);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] msgListIds){
		tMsgListService.removeByIds(Arrays.asList(msgListIds));

        return R.ok();
    }

}
